package com.google.gwt.gfx.client.services;

import com.google.gwt.gfx.client.shared.Viewport;

/**
 * A type of {@link RefreshService} that represents the region of interest as
 * grid-aligned tiles covering the window size specified by {@link #viewport()}.
 */
public interface TileService<V extends Viewport> extends RefreshService<V> {

	/**
	 * @return level of current scale
	 */
	int getLevel();

	/**
	 * @return offset along x-axis
	 */
	int getOffsetLeft();

	/**
	 * @return offset along y-axis
	 */
	int getOffsetTop();

	/**
	 * @return height of a tile
	 */
	int getTileHeight();

	/**
	 * Creates identity of a tile.
	 * 
	 * @param col
	 *            column of a tile in a grid
	 * @param row
	 *            row of a tile in a grid
	 * @param level
	 *            level of a tile grid
	 * @return identity of a tile
	 */
	String getTileID(int col, int row, int level);

	/**
	 * Creates URL of a tile.
	 * 
	 * @param col
	 *            column of a tile in a grid
	 * @param row
	 *            row of a tile in a grid
	 * @param level
	 *            level of a tile grid
	 * @return URL of a tile
	 */
	String getTileUrl(int col, int row, int level);

	/**
	 * @return width of a tile
	 */
	int getTileWidth();

}
